package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo2 {
    public static void main(String[] args) throws IOException {
        FileInputStream ifs=new FileInputStream("./th.jpg");
        FileOutputStream ofs=new FileOutputStream("./copt2.jpg");
        byte []data=new byte[1024*10];//10kb
        int len;
        long start=System.currentTimeMillis();
        while((len=ifs.read(data))!=-1)
            ofs.write(data);
        long end=System.currentTimeMillis();
        System.out.println("复制完毕，用时："+(end-start)+"毫秒");
        ifs.close();
        ofs.close();

    }
}
